import {getCommonFieldList} from '@/api/static'
import myLocalStorage from '@/utils/localStorage'

const state = {
  // 路由列表
  routeList: [{
    'permissionId': '1',
    'subordinate': true,
    'permissionName': 'main',
    'parentPermissionCode': '',
    'permissionCode': '00',
    'path': '',
    'reorder': 1
  }],
  // 配送单位
  unitTypeList: [{
    label: '小包装',
    value: 1
  }, {
    label: '中包装',
    value: 2
  }, {
    label: '大包装',
    value: 3
  }],
  // 车辆类型
  carTypeList: [{
    label: '小面包车',
    value: 1
  }, {
    label: '大面包车',
    value: 2
  }, {
    label: '小货车',
    value: 3
  }, {
    label: '中货车',
    value: 4
  }, {
    label: '大货车',
    value: 5
  }],
  // 车辆功能
  carLoadingTypeList: [{
    label: '常温车',
    value: 0
  }, {
    label: '冷冻车',
    value: 1
  }, {
    label: '其他',
    value: 2
  }],
  // 车辆状态
  carStateList: [{
    label: '空闲',
    value: 0
  }, {
    label: '配送中',
    value: 1
  }, {
    label: '报修中',
    value: 2
  }, {
    label: '停用',
    value: 3
  }],
  // 仓库订单处理方式
  warehouseOrderHandleTypeList: [{
    label: '需要接单',
    checked: false,
    value: 'orderProcessNodeMustReceive'
  }, {
    label: '需要分拣',
    checked: false,
    value: 'orderProcessNodeMustPick'
  }, {
    label: '需要复核',
    checked: false,
    value: 'orderProcessNodeMustReview'
  }, {
    label: '需要配送',
    checked: false,
    value: 'orderProcessNodeMustDelivery'
  }],
  // 仓库分拣范围
  warehouseSortingRangeList: [{
    label: '按区域类型设置',
    value: 0
  }, {
    label: '按区域设置',
    value: 1
  }, {
    label: '按排设置',
    value: 2
  }, {
    label: '按组设置',
    value: 3
  }],
  // 仓库区域类型列表
  locationAreaTypeList: [{
    label: '散件区',
    value: 1,
    color: '#D81E06'
  }, {
    label: '整件区',
    value: 2,
    color: '#71F4FE'
  }, {
    label: '贵重商品区',
    value: 3,
    color: '#8E4CBA'
  }, {
    label: '加工区',
    value: 4,
    color: '#58A900'
  }, {
    label: '退货区',
    value: 5,
    color: '#F9CE00'
  }, {
    label: '待配送区',
    value: 6,
    color: '#D86F06'
  }, {
    label: '物料区',
    value: 7,
    color: '#F37EF9'
  }, {
    label: '周转区',
    value: 8,
    color: '#35D0BA'
  }, {
    label: '收货区',
    value: 9,
    color: '#00B1FF'
  }, {
    label: '异常商品区',
    value: 10,
    color: '#211B1A'
  }, {
    label: '冷藏区',
    value: 11,
    color: '#4B5CC4'
  }],
  // 采购订单状态列表
  purchaseOrderStateList: [{
    label: '待一审',
    value: 0
  }, {
    label: '待二审',
    value: 1
  }, {
    label: '待三审',
    value: 15
  }, {
    label: '待支付',
    value: 2
  }, {
    label: '待接单',
    value: 3
  }, {
    label: '待生成分拣单',
    value: 14
  }, {
    label: '待分拣',
    value: 4
  }, {
    label: '待复核',
    value: 5
  }, {
    label: '待分配',
    value: 6
  }, {
    label: '待发货',
    value: 7
  }, {
    label: '已发货',
    value: 8
  }, {
    label: '已送达',
    value: 9
  }, {
    label: '已完成',
    value: 10
  }, {
    label: '已撤单',
    value: 11
  }, {
    label: '已收货',
    value: 12
  }, {
    label: '已存放',
    value: 13
  }],
  // 供应商品状态列表
  supplyGoodsStateList: [{
    label: '待一审',
    value: 0
  }, {
    label: '可供',
    value: 1
  }, {
    label: '待二审',
    value: 2
  }, {
    label: '不可供',
    value: 3
  }, {
    label: '待三审',
    value: 4
  }],
  // 补货单分拣状态
  purchaseOrderSortTypeList: [{
    label: '待分拣',
    value: 1
  }, {
    label: '分拣中',
    value: 2
  }, {
    label: '已分拣',
    value: 3
  }],
  // 机构图片上传类型
  organizationPictureTypeList: [{
    label: '机构logo',
    value: 1
  }, {
    label: '营业执照',
    value: 2
  }, {
    label: '门头',
    value: 3
  }, {
    label: '收银台',
    value: 4
  }, {
    label: '店内环境1',
    value: 5
  }, {
    label: '店内环境2',
    value: 6
  }, {
    label: '街景照',
    value: 7
  }, {
    label: '法人身份证头像面',
    value: 8
  }, {
    label: '法人身份证国徽面',
    value: 9
  }, {
    label: '结算人身份证头像面',
    value: 10
  }, {
    label: '结算人身份证国徽面',
    value: 11
  }, {
    label: '银行卡正面',
    value: 12
  }, {
    label: '银行卡背面',
    value: 13
  }, {
    label: '结算人手持身份证照',
    value: 14
  }, {
    label: '开户证明',
    value: 15
  }, {
    label: '协议',
    value: 16
  }, {
    label: '授权结算书',
    value: 17
  }, {
    label: '租赁协议',
    value: 18
  }, {
    label: '产权证明',
    value: 19
  }, {
    label: '执业资质证照',
    value: 20
  }, {
    label: '第三方证明',
    value: 21
  }, {
    label: '其他小微商户证明材料',
    value: 22
  }, {
    label: '经营商品照片',
    value: 23
  }, {
    label: '收银机登录页图片',
    value: 24
  }],
  // 供应商配送方式
  supplierDeliveryTypeList: [{
    label: '仓库下单仓库收货',
    value: 1
  }, {
    label: '店铺下单仓库收货再配店铺',
    value: 2
  }, {
    label: '店铺下单店铺收货',
    value: 3
  }],
  // 供应商账类
  supplierAccountTypeList: [{
    label: '现金结',
    value: 1
  }, {
    label: '账期结-周结',
    value: 2
  }, {
    label: '账期结-半月结',
    value: 4
  }, {
    label: '账期结-月结',
    value: 5
  }, {
    label: '联营',
    value: 3
  }],
  // 金币提现状态
  goldExchangeStateList: [{
    label: '待审核',
    value: 1
  }, {
    label: '待打款',
    value: 4
  }, {
    label: '已打款',
    value: 5
  }, {
    label: '审核不通过',
    value: 6
  }],
  // 支付方式
  payMethodList: [{
    name: '现金',
    value: 1
  }, {
    name: 'B扫C',
    value: 2
  }, {
    name: 'C扫B',
    value: 3
  }, {
    name: '微信小程序',
    value: 9
  }, {
    name: '支付宝转账',
    value: 10
  }, {
    name: '微信转账',
    value: 11
  }, {
    name: '对公转账',
    value: 12
  }, {
    name: '银行卡转账',
    value: 13
  }, {
    name: '赊账',
    value: 14
  }],
  // 库存变化记录类别
  stockChangeSortList: [{
    name: '初始库存',
    value: 1
  }, {
    name: '采购（补货）',
    value: 2
  }, {
    name: '销售',
    value: 3
  }, {
    name: '销售退货',
    value: 10
  }, {
    name: '盘点',
    value: 4
  }, {
    name: '无订单入库',
    value: 6
  }, {
    name: '库存调整单',
    value: 8
  }, {
    name: '退货单',
    value: 9
  }, {
    name: '报损',
    value: 5
  }, {
    name: '会员消费排名活动兑奖',
    value: 7
  }],
  // 支付通道
  payChannelList: [{
    name: '支付宝支付',
    value: 1
  }, {
    name: '微信支付',
    value: 2
  }, {
    name: '银行卡转账',
    value: 4
  }, {
    name: '云闪付',
    value: 5
  }, {
    name: '支付宝转账',
    value: 8
  }, {
    name: '微信转账',
    value: 9
  }, {
    name: '现金',
    value: 10
  }, {
    name: '赊账',
    value: 11
  }, {
    name: '对公转账',
    value: 12
  }, {
    name: '银联支付',
    value: 13
  }],
  // 交易订单类型
  transactionSortList: [{
    name: '销售订单',
    value: 1
  }, {
    name: '销售订单退货',
    value: 2
  }, {
    name: '采购（补货）订单',
    value: 3
  }, {
    name: '采购（补货）订单退款',
    value: 4
  }, {
    name: '采购（补货）配送差异赔付',
    value: 5
  }],
  // 交易订单类型（店铺）
  transactionSortListOfStore: [{
    name: '销售订单',
    value: 1
  }, {
    name: '销售订单退货',
    value: 2
  }, {
    name: '补货配送差异赔付',
    value: 5
  }],
  goodsReturnStateList: [{
    name: '全部状态',
    value: -1
  }, {
    name: '待审核',
    value: 0
  }, {
    name: '待二审',
    value: 1
  }, {
    name: '待三审',
    value: 2
  }, {
    name: '审核不通过',
    value: 3
  }, {
    name: '待收回',
    value: 4
  }, {
    name: '待入库',
    value: 5
  }, {
    name: '待差异审核',
    value: 6
  }, {
    name: '待退款',
    value: 7
  }, {
    name: '已完成',
    value: 10
  }],
  goodsReturnDifferenceStateList: [{
    name: '全部状态',
    value: -1
  }, {
    name: '待审核',
    value: 0
  }, {
    name: '待二审',
    value: 1
  }, {
    name: '待三审',
    value: 2
  }, {
    name: '待退款',
    value: 3
  }, {
    name: '已退款',
    value: 4
  }, {
    name: '审核不通过',
    value: 5
  }, {
    name: '已完成',
    value: 10
  }],
  evaluationFormSortList: [{
    name: '店铺招商评估表',
    value: 1
  }],
  potentialCustomerStoreCustomerStateList: [{
    name: '潜在客户',
    value: 0
  }, {
    name: '意向客户',
    value: 1
  }, {
    name: '待签约客户',
    value: 2
  }, {
    name: '成交客户',
    value: 3
  }],
  benefitCardStateList: [{
    name: '待审核',
    value: 0
  }, {
    name: '已启用',
    value: 1
  }, {
    name: '已过期',
    value: 2
  }, {
    name: '已作废',
    value: 3
  }],
  businessSortList: [{
    name: '未知',
    value: 0
  }, {
    name: 'B端补货',
    value: 1
  }, {
    name: 'C端无人销售',
    value: 2
  }, {
    name: 'C端购买商品',
    value: 3
  }, {
    name: 'C端买卡券',
    value: 4
  }, {
    name: 'C端买会员',
    value: 5
  }, {
    name: 'C端储值',
    value: 6
  }, {
    name: 'B端买卡券',
    value: 7
  }, {
    name: 'B端买会员',
    value: 8
  }, {
    name: 'B端储值',
    value: 9
  }, {
    name: 'B端机构账号续费',
    value: 10
  }, {
    name: 'C端购买商品退货',
    value: 11
  }, {
    name: 'C端购买商品（一件代发）',
    value: 12
  }, {
    name: '手续费',
    value: 51
  }],
  distributionChannelList: [{
    name: '线上小程序渠道',
    value: 3
  }, {
    name: '线下渠道',
    value: 2
  }],
  discountMethodsList: [{
    name: '优惠券',
    value: 1
  }, {
    name: '秒杀',
    value: 2
  }, {
    name: '折扣',
    value: 3
  }, {
    name: '满减送',
    value: 4
  }, {
    name: '加价购',
    value: 5
  }, {
    name: '积分兑换',
    value: 6
  }, {
    name: '积分抵现',
    value: 7
  }, {
    name: '赠品领取',
    value: 8
  }, {
    name: '会员折扣',
    value: 9
  }, {
    name: '储值专享折扣',
    value: 10
  }, {
    name: '抹零',
    value: 11
  }, {
    name: '收银台折扣',
    value: 12
  }, {
    name: '整单改价',
    value: 13
  }, {
    name: '商品临时改价',
    value: 14
  }],
  changeLimitOrganizationTypeList: [{
    name: '额度调整',
    value: 1
  }, {
    name: '进货订单确认',
    value: 2
  }, {
    name: '进货订单收货差异',
    value: 3
  }, {
    name: '退货单',
    value: 4
  }, {
    name: '销售订单',
    value: 5
  }, {
    name: '销售退货订单',
    value: 6
  }, {
    name: '销售订单优惠',
    value: 7
  }, {
    name: '销售订单抵消',
    value: 8
  }],
  goodsCreateSourceList: [{
    name: '收银机扫码',
    value: 1
  }, {
    name: '手机收银扫码',
    value: 2
  }, {
    name: '机构自己导入',
    value: 3
  }, {
    name: '上级机构导入',
    value: 4
  }, {
    name: '建档单',
    value: 5
  }, {
    name: '无订单入库',
    value: 6
  }, {
    name: '补货单',
    value: 7
  }, {
    name: '下级机构建档同步',
    value: 8
  }, {
    name: '可供商品同步',
    value: 9
  }, {
    name: '店型同步',
    value: 10
  }, {
    name: '后台手动添加',
    value: 11
  }],
  paySettlementStatisticSortList: [{
    name: '营业额-线上支付',
    value: 1
  }, {
    name: '营业额-现金上缴',
    value: 2
  }, {
    name: '连锁内店铺进货',
    value: 3
  }, {
    name: '采购退货款',
    value: 4
  }, {
    name: '加盟联营分账',
    value: 5
  }, {
    name: '店铺系统续费',
    value: 6
  }, {
    name: '供应商系统续费',
    value: 7
  }, {
    name: '预购卡',
    value: 8
  }, {
    name: '会员费收入',
    value: 9
  }, {
    name: '供应商促销费',
    value: 10
  }, {
    name: '租金',
    value: 11
  }, {
    name: '纸皮收入',
    value: 12
  }, {
    name: '司机赔偿',
    value: 13
  }, {
    name: '店铺其他款项',
    value: 14
  }, {
    name: '连锁进货',
    value: 15
  }, {
    name: '连锁外店铺进货',
    value: 16
  }, {
    name: '补货退货款',
    value: 17
  }, {
    name: '其他',
    value: 99
  }],
  paySettlementStatisticSortListOfChain: [{
    name: '营业额-线上支付',
    value: 1
  }, {
    name: '营业额-现金上缴',
    value: 2
  }, {
    name: '连锁内店铺进货',
    value: 3
  }, {
    name: '采购退货款',
    value: 4
  }, {
    name: '加盟联营分账',
    value: 5
  }, {
    name: '店铺系统续费',
    value: 6
  }, {
    name: '供应商系统续费',
    value: 7
  }, {
    name: '预购卡',
    value: 8
  }, {
    name: '会员费收入',
    value: 9
  }, {
    name: '供应商促销费',
    value: 10
  }, {
    name: '租金',
    value: 11
  }, {
    name: '纸皮收入',
    value: 12
  }, {
    name: '司机赔偿',
    value: 13
  }, {
    name: '店铺其他款项',
    value: 14
  }, {
    name: '其他',
    value: 99
  }],
  paySettlementStatisticSortListOfWarehouse: [{
    name: '连锁进货',
    value: 15
  }, {
    name: '连锁外店铺进货',
    value: 16
  }, {
    name: '司机赔偿',
    value: 13
  }, {
    name: '联营分账',
    value: 5
  }, {
    name: '补货退货款',
    value: 17
  }, {
    name: '其他',
    value: 99
  }],
  paySettlementStatisticSortListOfStore: [{
    name: '营业额-线上支付',
    value: 1
  }, {
    name: '营业额-现金上缴',
    value: 2
  }, {
    name: '补货退货款',
    value: 4
  }, {
    name: '其他',
    value: 99
  }],
  stocktakeTaskStateList: [{
    name: '待盘点',
    value: 0
  }, {
    name: '盘点中',
    value: 1
  }, {
    name: '已完成',
    value: 2
  }],
  stocktakeOrderStateList: [{
    name: '待初盘',
    value: 0
  }, {
    name: '初盘中',
    value: 1
  }, {
    name: '复盘中',
    value: 2
  }, {
    name: '抽盘中',
    value: 3
  }, {
    name: '差异核盘中',
    value: 4
  }, {
    name: '待盈亏确认',
    value: 5
  }, {
    name: '已完成',
    value: 6
  }],
  stocktakeProfitLossReasonList: [{
    name: '未查找原因',
    value: 0
  }, {
    name: '盘点错误',
    value: 1
  }, {
    name: '销售错误',
    value: 2
  }, {
    name: 'A商品销售成B商品',
    value: 3
  }, {
    name: '内部偷盗',
    value: 4
  }, {
    name: '外部偷盗',
    value: 5
  }, {
    name: '建档库存错误',
    value: 6
  }, {
    name: '/无订单入库错误',
    value: 7
  }, {
    name: '验收入库错误',
    value: 8
  }, {
    name: '配送差异单审核错误',
    value: 9
  }, {
    name: '退货单错误',
    value: 10
  }, {
    name: '报损单错误',
    value: 11
  }, {
    name: '调拨单错误',
    value: 12
  }, {
    name: '其他原因',
    value: 13
  }],
  procurementSettlementOrderStatusList: [{
    name: '待一审',
    value: 0
  }, {
    name: '待二审',
    value: 1
  }, {
    name: '待三审',
    value: 2
  }, {
    name: '待对账',
    value: 3
  }, {
    name: '待开票',
    value: 4
  }, {
    name: '待付款',
    value: 5
  }, {
    name: '已完成',
    value: 6
  }, {
    name: '已驳回',
    value: 7
  }],
  procurementSettlementBusinessOrderStatusList: [{
    name: '待对账',
    value: 0
  }, {
    name: '待支付',
    value: 1
  }, {
    name: '已支付',
    value: 2
  }],
  purchaseSettlementOrderSort: [{
    name: '采购单',
    value: 1
  }, {
    name: '退货单',
    value: 2
  }],
  // ----------------------
  // 商品数量单位
  goodsQuantityUnitList: myLocalStorage.getJsonItem('goodsQuantityUnitList'),
  // 商品重量单位
  goodsWeightUnitList: myLocalStorage.getJsonItem('goodsWeightUnitList'),
  // 按商圈划分店型列表
  storeTypeBusinessCircleList: myLocalStorage.getJsonItem('storeTypeBusinessCircleList'),
  // 按面积划分店型列表
  storeTypeStoreAreaList: myLocalStorage.getJsonItem('storeTypeStoreAreaList'),
  // 按年龄层划分店型列表
  storeTypeListByAge: myLocalStorage.getJsonItem('storeTypeListByAge'),
  // 店铺登记
  storeLevelList: myLocalStorage.getJsonItem('storeLevelList'),
  // 店铺星级列表
  storeStartList: myLocalStorage.getJsonItem('storeStartList'),
  // 机构类型列表
  organizationTypeList: myLocalStorage.getJsonItem('organizationTypeList'),
  // 可否退货类型
  returnTypeList: myLocalStorage.getJsonItem('returnTypeList'),
  // 销售状态列表
  saleStateList: myLocalStorage.getJsonItem('saleStateList'),
  // 销售情况列表
  saleSituationList: myLocalStorage.getJsonItem('saleSituationList'),
  // 显示标签列表
  displayLabelList: myLocalStorage.getJsonItem('displayLabelList'),
  // 机构行业列表
  organizationIndustryList: myLocalStorage.getJsonItem('organizationIndustryList'),
  // 仓库陈列位置列表
  warehouseDisplayLocationList: myLocalStorage.getJsonItem('warehouseDisplayLocationList'),
  // 机构类别列表
  organizationCategoryList: myLocalStorage.getJsonItem('organizationCategoryList')
}

const mutations = {
  SET_GOODS_QUANTITY_UNIT_LIST: (state, goodsQuantityUnitList) => {
    state.goodsQuantityUnitList = goodsQuantityUnitList
  },
  SET_GOODS_WEIGHT_UNIT_LIST: (state, goodsWeightUnitList) => {
    state.goodsWeightUnitList = goodsWeightUnitList
  },
  SET_STORE_TYPE_BUSINESS_CIRCLE_LIST: (state, storeTypeBusinessCircleList) => {
    state.storeTypeBusinessCircleList = storeTypeBusinessCircleList
  },
  SET_STORETYPELISTBYAREA: (state, storeTypeStoreAreaList) => {
    state.storeTypeStoreAreaList = storeTypeStoreAreaList
  },
  SET_STORETYPELISTBYAGE: (state, storeTypeListByAge) => {
    state.storeTypeListByAge = storeTypeListByAge
  },
  SET_STORELEVELLIST: (state, storeLevelList) => {
    state.storeLevelList = storeLevelList
  },
  SET_STORESTARTLIST: (state, storeStartList) => {
    state.storeStartList = storeStartList
  },
  SET_ORGANIZATIONTYPELIST: (state, organizationTypeList) => {
    state.organizationTypeList = organizationTypeList
  },
  SET_RETURNTYPELIST: (state, returnTypeList) => {
    state.returnTypeList = returnTypeList
  },
  SET_SALESTATELIST: (state, saleStateList) => {
    state.saleStateList = saleStateList
  },
  SET_SALESITUATIONLIST: (state, saleSituationList) => {
    state.saleSituationList = saleSituationList
  },
  SET_DISPLAYLABELLIST: (state, displayLabelList) => {
    state.displayLabelList = displayLabelList
  },
  SET_ORGANIZATIONINDUSTRYLIST: (state, organizationIndustryList) => {
    state.organizationIndustryList = organizationIndustryList
  },
  SET_WAREHOUSEDISPLAYLOCATIONLIST: (state, warehouseDisplayLocationList) => {
    state.warehouseDisplayLocationList = warehouseDisplayLocationList
  },
  SET_ORGANIZATIONCATEGORYLIST: (state, organizationCategoryList) => {
    state.organizationCategoryList = organizationCategoryList
  }
}

const actions = {
  setGoodsQuantityUnitList({commit, state}) {
    return new Promise((resolve, reject) => {
      getCommonFieldList({commonFieldCategoryIdList: [1], page: 1, pageSize: 999})
        .then(response => {
          // 将fieldId转换为字符串，因为后台单位存储的类型为Long，转换到前端为字符串
          for (const i in response.list) {
            response.list[i].fieldId = response.list[i].fieldId + ''
          }
          commit('SET_GOODS_QUANTITY_UNIT_LIST', response.list)
          myLocalStorage.setJsonItem('goodsQuantityUnitList', response.list)
          return resolve(response)
        })
        .catch(err => {
          reject(err)
        })
    })
  },
  setGoodsWeightUnitList({commit, state}) {
    return new Promise((resolve, reject) => {
      getCommonFieldList({commonFieldCategoryIdList: [2], page: 1, pageSize: 999})
        .then(response => {
          commit('SET_GOODS_WEIGHT_UNIT_LIST', response.list)
          myLocalStorage.setJsonItem('goodsWeightUnitList', response.list)
          return resolve(response)
        })
        .catch(err => {
          reject(err)
        })
    })
  },
  setStoreTypeListByBusinessDistrict({commit, state}) {
    return new Promise((resolve, reject) => {
      getCommonFieldList({commonFieldCategoryIdList: [3], page: 1, pageSize: 999})
        .then(response => {
          commit('SET_STORE_TYPE_BUSINESS_CIRCLE_LIST', response.list)
          myLocalStorage.setJsonItem('storeTypeBusinessCircleList', response.list)
          return resolve(response)
        })
        .catch(err => {
          reject(err)
        })
    })
  },
  setStoreTypeListByArea({commit, state}) {
    return new Promise((resolve, reject) => {
      getCommonFieldList({commonFieldCategoryIdList: [4], page: 1, pageSize: 999})
        .then(response => {
          commit('SET_STORETYPELISTBYAREA', response.list)
          myLocalStorage.setJsonItem('storeTypeStoreAreaList', response.list)
          return resolve(response)
        })
        .catch(err => {
          reject(err)
        })
    })
  },
  setStoreTypeListByAge({commit, state}) {
    return new Promise((resolve, reject) => {
      getCommonFieldList({commonFieldCategoryIdList: [5], page: 1, pageSize: 999})
        .then(response => {
          commit('SET_STORETYPELISTBYAGE', response.list)
          myLocalStorage.setJsonItem('storeTypeListByAge', response.list)
          return resolve(response)
        })
        .catch(err => {
          reject(err)
        })
    })
  },
  setStoreLevelList({commit, state}) {
    return new Promise((resolve, reject) => {
      getCommonFieldList({commonFieldCategoryIdList: [6], page: 1, pageSize: 999})
        .then(response => {
          commit('SET_STORELEVELLIST', response.list)
          myLocalStorage.setJsonItem('storeLevelList', response.list)
          return resolve(response)
        })
        .catch(err => {
          reject(err)
        })
    })
  },
  setStoreStartList({commit, state}) {
    return new Promise((resolve, reject) => {
      getCommonFieldList({commonFieldCategoryIdList: [7], page: 1, pageSize: 999})
        .then(response => {
          commit('SET_STORESTARTLIST', response.list)
          myLocalStorage.setJsonItem('storeStartList', response.list)
          return resolve(response)
        })
        .catch(err => {
          reject(err)
        })
    })
  },
  setOrganizationTypeList({commit, state}) {
    return new Promise((resolve, reject) => {
      getCommonFieldList({commonFieldCategoryIdList: [8], page: 1, pageSize: 999})
        .then(response => {
          commit('SET_ORGANIZATIONTYPELIST', response.list)
          myLocalStorage.setJsonItem('organizationTypeList', response.list)
          return resolve(response)
        })
        .catch(err => {
          reject(err)
        })
    })
  },
  setReturnTypeList({commit, state}) {
    return new Promise((resolve, reject) => {
      getCommonFieldList({commonFieldCategoryIdList: [9], page: 1, pageSize: 999})
        .then(response => {
          commit('SET_RETURNTYPELIST', response.list)
          myLocalStorage.setJsonItem('returnTypeList', response.list)
          return resolve(response)
        })
        .catch(err => {
          reject(err)
        })
    })
  },
  setSaleStateList({commit, state}) {
    return new Promise((resolve, reject) => {
      getCommonFieldList({commonFieldCategoryIdList: [10], page: 1, pageSize: 999})
        .then(response => {
          commit('SET_SALESTATELIST', response.list)
          myLocalStorage.setJsonItem('saleStateList', response.list)
          return resolve(response)
        })
        .catch(err => {
          reject(err)
        })
    })
  },
  setSaleSituationList({commit, state}) {
    return new Promise((resolve, reject) => {
      getCommonFieldList({commonFieldCategoryIdList: [11], page: 1, pageSize: 999})
        .then(response => {
          commit('SET_SALESITUATIONLIST', response.list)
          myLocalStorage.setJsonItem('saleSituationList', response.list)
          return resolve(response)
        })
        .catch(err => {
          reject(err)
        })
    })
  },
  setDisplayLabelList({commit, state}) {
    return new Promise((resolve, reject) => {
      getCommonFieldList({commonFieldCategoryIdList: [12], page: 1, pageSize: 999})
        .then(response => {
          commit('SET_ORGANIZATIONINDUSTRYLIST', response.list)
          myLocalStorage.setJsonItem('displayLabelList', response.list)
          return resolve(response)
        })
        .catch(err => {
          reject(err)
        })
    })
  },
  setOrganizationIndustryList({commit, state}) {
    return new Promise((resolve, reject) => {
      getCommonFieldList({commonFieldCategoryIdList: [13], page: 1, pageSize: 999})
        .then(response => {
          commit('SET_GOODS_QUANTITY_UNIT_LIST', response.list)
          myLocalStorage.setJsonItem('organizationIndustryList', response.list)
          return resolve(response)
        })
        .catch(err => {
          reject(err)
        })
    })
  },
  setWarehouseDisplayLocationList({commit, state}) {
    return new Promise((resolve, reject) => {
      getCommonFieldList({commonFieldCategoryIdList: [14], page: 1, pageSize: 999})
        .then(response => {
          commit('SET_WAREHOUSEDISPLAYLOCATIONLIST', response.list)
          myLocalStorage.setJsonItem('warehouseDisplayLocationList', response.list)
          return resolve(response)
        })
        .catch(err => {
          reject(err)
        })
    })
  },
  setOrganizationCategoryList({commit, state}) {
    return new Promise((resolve, reject) => {
      getCommonFieldList({commonFieldCategoryIdList: [15], page: 1, pageSize: 999})
        .then(response => {
          commit('SET_ORGANIZATIONCATEGORYLIST', response.list)
          myLocalStorage.setJsonItem('organizationCategoryList', response.list)
          return resolve(response)
        })
        .catch(err => {
          reject(err)
        })
    })
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
